<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/bootstrap-validator/0.5.3/css/bootstrapValidator.css"/>
<link rel="stylesheet" href="/css/community.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script  src="https://cdn.staticfile.org/bootstrap-validator/0.5.3/js/bootstrapValidator.min.js"></script>
<body>
<div th:fragment="nav">
    <nav class="navbar navbar-default" style="margin-bottom:4px" >
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Q&A</span>
                </button>
                <a class="navbar-brand" href="/">Q&A</a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <form class="navbar-form navbar-left" action="/" method="get">
                    <div class="form-group">
                        <input type="text" class="form-control" name="search" placeholder="搜索问题">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
                <ul class="nav navbar-nav navbar-right">
                    <li th:if="${session.user != null}">
                        <input type="hidden" id="userId" th:value="${session.user.id}">
                        <a href="/publish">提问</a>
                    </li>
                    <li ><a href="/profile/replies"><img src="/images/messageIcon.png" alt="" width="16px" height="16px"> <span id="messageInfo" class="badge" th:text="${session.unreadCount}"></span></a>
                    </li>
                    <li class="dropdown"  th:if="${session.user != null}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">
                            <span  id="nick" th:text="${session.userInfo.accountId}" ></span>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" style="text-align: left; min-width: 50px;">
                            <li><a href="/profile/questions">我的问题</a></li>
                            <li><a href="/userInfo/queryInfo">个人资料</a></li>
                            <li><a href="/logout">退出登录</a></li>
                        </ul>
                    </li>

                    <li th:if="${session.user != null}">
                        <img  id="login_img" th:src="${session.userInfo.avatarUrl!=null?session.userInfo.avatarUrl:'/images/gua.jpg'}" class="login_img">
                    </li>
                    <li th:if="${session.user == null}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">
                            <span>登陆</span>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" style="text-align: left; min-width: 50px;">
                            <li >
                                <a href="javascript:void(0)" data-toggle="modal" data-target="#myModal1">注册</a>
                            </li>
                            <li >
                                <a href="javascript:void(0)" data-toggle="modal" data-target="#myModal2">登陆</a>
                            </li>
                            <li><a th:href="@{https://github.com/login/oauth/authorize(client_id='ffa2b92dc0c79ab1fb1f',redirect_uri=${#httpServletRequest.getServletContext().getAttribute('redirectUri')},scope='user',state=1)}">Github登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <div th:insert="~{register :: register}"></div>
</div>
</body>
</html>
